import axios from 'axios'
import { baseURL } from './baserurl'
console.log(baseURL)
const service = axios.create({
  baseURL,
  timeout: 20000,
})

service.interceptors.request.use(
  (config) => {
    // const token = localStorage.getItem('token') || ''
    // if (token && !config.headers.Authorization) {
    //   config.headers.Authorization = 'Bearer ' + token
    // }
    /* 接口发送请求拦截器逻辑 */
    return config
  },
  (error) => {
    return error
  }
)

service.interceptors.response.use(
  (response) => {
    /* 接口响应请求拦截器逻辑 */
    return response.data
  },
  (error) => {
    return error
  }
)

export default service
